﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Service;
using Model;

namespace Manager
{
    /// <summary>
    /// Menu业务逻辑
    /// 创建人：Wilson
    /// 创建时间：2013-1-29  
    /// </summary>
    public class MenuManager
    {
        			
        #region##通过主键ID得到Menu
        /// <summary>
        /// 功能：通过ID得到Menu
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-29   
        /// </summary>
        /// <param name="">主键ID</param>
        /// <returns></returns>
        public Menu GetById(int menuid)
        {            
            using (MenuService ws = new MenuService())
			{
				return ws.GetById(menuid);
			}
        }
        #endregion
		
		#region##通过主键ID删除Menu
        /// <summary>
        /// 功能：通过主键ID删除Menu
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-29   
        /// </summary>
        /// <param name="">主键ID</param>
        /// <returns></returns>
		public int DeleteById(int menuid)
		{
			using (MenuService ws = new MenuService())
			{
				return ws.DeleteById(menuid);
			}
		}
		#endregion			
		
        #region##添加Menu
        /// <summary>
        /// 功能：添加Menu
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-29
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public int Add(Menu menu)
        {
            using (MenuService ws = new MenuService())
			{
				return ws.Add(menu);
			}
        }
        #endregion
		
		#region##得到Menu集合
		/// <summary>
        /// 功能：得到Menu集合
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-29
        /// </summary>       
        /// <returns></returns>
		public IList<Menu> GetList()
		{
		    using (MenuService ws = new MenuService())
			{
				return ws.GetList();
			}
		}
		#endregion
		
		#region##修改Menu
        /// <summary>
        /// 功能：修改Menu
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-29
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public int ModMenu(Menu menu)
        {
            using (MenuService ws = new MenuService())
			{
				return ws.ModMenu(menu);
			}
        }
        #endregion
		
		#region##统计Menu
		/// <summary>
        /// 修改Menu
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-29
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
		public int SelectCount()
		{
			using (MenuService ws = new MenuService())
			{
				return ws.SelectCount();
			}
		}
        /// <summary>
        /// 修改Menu
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-29
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public int SelectCountById()
        {
            using (MenuService ws = new MenuService())
			{
				return ws.SelectCountById();
			}
        }
		#endregion
        #region##自定义Menu
        public List<Menu> NameFilter(string name)
        {
            //return dao.DataBase.X_Menu.Where(p => p.NAME != name.Trim()).ToList();
            using (MenuService ws = new MenuService())
            {
                return ws.NameFilter(name).ToList();
            }
        }

        #endregion
    }
}